﻿using AntUnion.FrameWork.Model.Models;
using Microsoft.AspNetCore.Mvc;
using System.Linq;

namespace AntUnion.FrameWork.Web.Controllers
{
    public class ErrorController : Controller
    {
        public IActionResult NoPage()
        {
            return View();
        }

        public IActionResult SystemMaintenance(string language = "user-zh-CN")
        {
            string defaultLanguage = "zh-CN";
            if (language == "user-en-US")
            {
                defaultLanguage = "en-US";
            }
            using (mtContext mtContext = new mtContext())
            {
                TbSystemConfig maintenanceExplainConfig = mtContext.TbSystemConfigs.Where(k => k.Language == defaultLanguage && k.MenuName == "maintenanceExplain" && k.Status == true && k.ConfigTab == 1).FirstOrDefault();
                if (maintenanceExplainConfig != null)
                {
                    ViewBag.systemMaintenance = maintenanceExplainConfig.Value;
                }
                else
                {
                    ViewBag.systemMaintenance = "";
                }
            }
            return View();
        }
    }
}
